package FIT::Document::Transformer::Error;

use FIT::Class;
use FIT::Document::Parser::Twig;

extends 'FIT::Document::Transformer::Base';

has description => (is => 'ro', isa => 'Str', required => 1);

sub _transform {
    my $element = shift;
    $element = $element->first_cell unless $element->tag eq 'td';
    $element->set_att(class => 'fit_error');
    XML::Twig::Elt->new('hr')->paste( last_child => $element );
    my $headline_pre = XML::Twig::Elt->new('pre');
    $headline_pre->paste( last_child => $element );
    $headline_pre->set_att(class => 'fit_wrong_note');
    # my ($headline, $body) = split /\n/, $self->description, 2;
    $headline_pre->set_text( $self->description ); # $headline. $body? ("\n". $body): '' );
}
